#include <iostream>
#include <string>
#include <cstring>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>

int main(int argc,char*argv[])
{
    if(argc!=3)
    {
        Usage(argv[0]);
        return 1;
    }
    std::string svr_ip=argv[1];
    uint16_t svr_port=(uint16_t)atoi(argv[2]);

    int sock=socket(AF_INET,SOCK_STREAM,0);
    if(sick<0)
    {
        std::cerr<<"socket error!"<<std::endl;
        return 2;
    }
    
    struct sockaddr_in server;
    bzero(&server,sizeof(server));
    server.sin_family=AF_INET;
    server.sin_addt.s_addr=inet_addr(svr_ip.c_str());
    server.sin_port=htons(svr_port);
    if(connect(sock,(struct sockaddr*)&server,sizeof(server))<0)
    {
        std::cout<<"connect server failed!"<<std::endl;
        return 3;
    }

    std::cout<<"connect success!"<<std::endl;

    while(true)
    {
        std::cout<<"Please Enter ";
        char buffer[1024];
        fgets(buffer,sizeof(buffer)-1,stdin);

        write(sock,buffer,strlen(buffer));

        ssize_t s=read(sock,buffer,sizeof(buffer)-1);
        if(s>0)
        {
            buffer[s]=0;
            std::cout<<""
        }
    }
    return 0;
}